home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_2
/
fpgdir
< prev
next >
Wrap
Internet Message Format
|
1995-03-31
|
6KB
From comp.sys.handhelds Sun Jun 9 13:41:11 1991
Path: seq!ecsgate!mcnc!uvaarpa!haven.umd.edu!udel!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-pcd!hpcvra.cv.hp.com!rnews!hpcvbbs!akcs.joehorn
From: akcs.joehorn@hpcvbbs.UUCP (Joseph K. Horn)
Newsgroups: comp.sys.handhelds
Subject: Re: HP 48 Faster PGDIR
Message-ID: <2850bd41:3374.4comp.sys.handhelds;1@hpcvbbs.UUCP>
Date: 8 Jun 91 11:40:08 GMT
References: <284dca48:3374comp.sys.handhelds@hpcvbbs.UUCP> <25590171@hpcvra.cv.
Lines: 42
Bill Wickes writes that running my FPGDIR after recalling objects from
the target directory to the stack can cause problems.
Wow! That's for sure! I just tried it, and the very first attempt
tanked everything in the machine.
Rats. The moral here is twofold:
(1) The obvious: don't use FPGDIR unless you KNOW FOR SURE that there are
no references to objects that will be left floating in limbo.
(2) Less obvious: Be Careful When You Hide Objects In Directories! Many
articles and programs about "hiding" things have floated down this
bitstream, and not once did anybody mention that hiding things in
directories can send the 48 out to lunch. But if ALL the items in a
directory are hidden, it's an accident waiting to happen. Because then
simply PURGEing the directory (if there are any memory references to its
contents) will cause problems at the next garbage collection.
The first moral is worded with "unless" because the situation is exactly
the same for the new 256K and 512K bankswitched cards now available for
the 48. I just played with a 512K card tonight at the 48 Club meeting in
L.A., and it has a BANKN function that allows you to bank switch WITHOUT
PERFORMING A SYSTEM HALT. The owner's manual clearly states that doing
this while there are any memory references to objects in the bank being
switched out will "at best cause unpredictable results." The reason this
is so is the same as the reason that FPGDIR is dangerous. If Tripod can
sell an item with functionality that's dangerous to use and assumes that
the user takes proper precautions, then I hope I can give away FPGDIR for
free with the same danger and assumptions.
What scares me, however, is the second moral. People are hiding things
gleefully, without any idea that Memory Clear awaits them if they don't
know the pitfalls of PURGE on directories whose contents are all hidden.
EduCALC Goodies Disk #5 will, of course, have all this documented,
hopefully to make up for the blissful endorsement of using null-named
objects that has been on previous Goodies Disks.
Thanx, Bill, for warning us of the dangers here, before my "wonderful new
discovery" (*sigh*) proliferated too far.
-- a crestfallen jkh --
From comp.sys.handhelds Sun Jun 9 13:52:04 1991
Path: seq!ecsgate!mcnc!gatech!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-pcd!hpcvra.cv.hp.com!rnews!hpcvbbs!akcs.joehorn
From: akcs.joehorn@hpcvbbs.UUCP (Joseph K. Horn)
Newsgroups: comp.sys.handhelds
Subject: HP 48 Faster PGDIR
Message-ID: <284dca48:3374comp.sys.handhelds@hpcvbbs.UUCP>
Date: 6 Jun 91 05:40:08 GMT
Lines: 85
FPGDIR, a FAST PGDIR, by Joseph K Horn. Makes PGDIR obsolete.
When you use PGDIR on a very large directory, it can take a long time
to finish. For example, I just used Donnelly's XTIME function to time
PGDIR on a big directory, and it took a painful 50 seconds!
Bill Wickes explains why in his excellent book, "HP 48 Insights":
"PGDIR removes a directory specified by name. It does
this by recursively executing CLVAR and PURGE recursively
on each subdirectory until the original directory is
empty. (This process can take a relatively long time if
the directory is large.)" [Part I, page 96]
Guess what! There's a better way!
Those of you with HP-41CX's will remember the CLRALMS command that
cleared all the alarms out. If you had a lot of alarms, it took a
long time to finish, because it looped through the alarm buffer
clearing each one individually. But a much better way was to treat
the entire buffer as one object, and clear it in one fell swoop.
This was possible with the buffer clearing functions available in
several plug-in ROMs. For example, with the Extended-IL ROM, just
execute 10 CLRBUF, and instantly the entire alarm buffer gets
cleared, no matter how large it is.
It turns out that there is a similar trick for purging directories
on the HP 48. Rather than painfully looping through them, clearing
their contents, we can treat the whole thing as a single object and
PURGE it in one fell swoop.
Here's the trick. The HP 48 Owner's Manual says:
"Once a directory is empty, you can purge it like any
other variable -- put its name on the stack and execute
PURGE." [Volume 1, page 123]
But "empty" means "when VARS == { }". And VARS == { } when all
the vars are "hidden" behind a null-named object (see NULLNAME.DOC
on Goodies Disk #1).
So the quick way to purge a directory is:
(1) Put its name on the stack;
(2) Get into that directory: DUP EVAL;
(3) Unhide everything (just in case): '' PURGE;
(4) Hide all its vars: 0 '' STO;
(5) Go back to the parent directory: UPDIR;
(6) Purge the "empty" directory: PURGE.
This process is automated by the following replacement for PGDIR:
---------------------< FPGDIR >---------------------------------
%%HP:T(1);
\<<
IF DUP TYPE 6 ==
THEN
IF DUP VTYPE -1 ==
THEN DROP
ELSE
IF DUP VTYPE 15 ==
THEN DUP EVAL 0 # 15777h SYSEVAL DUP PURGE STO UPDIR PURGE
ELSE 515 DOERR
END
END
ELSE 514 DOERR
END
\>>
----------------------------------------------------------------
Except for its improved speed, its action is exactly like PGDIR.
It even generates the same error messages as PGDIR in case of bad
arguments. Nonexistent names simply get dropped (like PGDIR does).
To use: place name of directory on stack, and run it.
It does full argument type checking, so it should be idiot proof.
I keep it assigned to my blue-shifted DEL key. That way it takes only
three keystrokes to delete a directory (tic, menu, FPGDIR).
It should be in "system RPL" ... but that's left as an exercise for
the reader. :-)
-- Joseph K Horn -- Peripheral Vision, Ltd. --